
#ifndef  HASHCONTAINER_H
#define  HASHCONTAINER_H

#include "common.h"
#include "IData.h"


class HashContainer : public IKvContainer{
public:
    HashContainer(){}
    virtual ~HashContainer(){}

    class Iterator: public IKvContainer::Iterator {
    public:
        Iterator(HashContainer & container);
        virtual ~Iterator();

        bool hasNext() const override;
        KvPair next() override;
    private:
        HashContainer & container;
        std::unordered_map<int, const char *>::iterator it;
    };

    std::shared_ptr<IKvContainer::Iterator> iterator() override;

    const char * get(const int key) const override;
    int put(const int key, const char * value) override;
    int remove(const int key) override;

    int size() override;

    int init() override {
        return 0;
    }
    int deinit() override{
        return 0;
    }

public:

    static void test();

private:
    std::unordered_map<int, const char*> data;
};


#endif   /* HASHCONTAINER_H */
